package com.ifudata.dvp.app.dao.factory;

import javax.annotation.PostConstruct;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ifudata.dvp.app.dao.definer.base.intefaces.DefinerSqlMapper;
import com.ifudata.dvp.app.dao.mapper.base.interfaces.AppCollectMapper;
import com.ifudata.dvp.app.dao.mapper.base.interfaces.AppMenuMapper;

@Component
public class MapperFactory {
	@Autowired
	private transient SqlSessionTemplate sqlSessionTemplate;

	private static SqlSessionTemplate st;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}

	public static void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		MapperFactory.st = sqlSessionTemplate;
	}
	
	/** 通用的查询接口Mapper*/
	public static DefinerSqlMapper getSimpleDataMapper() {
		return st.getMapper(DefinerSqlMapper.class);
	}

	/* VVV 其他表Mapper VVV */
	
	public static AppMenuMapper getAppMenuMapper() {
		return st.getMapper(AppMenuMapper.class);
	}
	
	public static AppCollectMapper getAppCollectMapper(){
		return st.getMapper(AppCollectMapper.class);
	}
	
}
